home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / ien / ien-173 < prev    next >
Text File  |  1988-12-01  |  21KB  |  438 lines

  1.  
  2.  
  3. IEN 173
  4.  
  5.  
  6.             Time Synchronization in DCNET Hosts
  7.               D.L. Mills, COMSAT Laboratories
  8.                          25-Feb-81
  9.  
  10.  
  11. Introduction
  12.  
  13. The difficulty in establishing an  absolute  time  reference
  14. for  use  in  internet measurements and experiments has been
  15. often lamented.  While  time  standards  calibrated  to  the
  16. precision  necessary for internet delay measurements (in the
  17. order of a millisecond) are readily available, the  cost  to
  18. equip  each  host which may participate in these experiments
  19. is significant and the broadcast services they  depend  upon
  20. may  not  be available where needed.  This note describes an
  21. alternative   mechanism   using   local-net   protocols   to
  22. synchronize  a  logical  clock  in each of a set of internet
  23. hosts to a single physical  clock,  such  as  an  NBS  radio
  24. clock.   The  mechanism has been incorporated as an integral
  25. component of the DCNET network routing algorithm and depends
  26. for  its  accuracy  upon the careful control of link delays.
  27. For this reason it may not be practically  applicable  as  a
  28. retrofit  in  the  ARPANET,  for example.  Nevertheless, the
  29. principles can be  applied  in  cases  where  somewhat  less
  30. precision is acceptable and where the participating hosts or
  31. gateways support the required protocol.
  32.  
  33. The DCNET Routing Algorithm
  34.  
  35. The  DCNET  includes  a  number  of  PDP11-compatible  hosts
  36. interconnected  by  dedicated  and  dial-up links of various
  37. types,  including  simple   synchronous   and   asynchronous
  38. point-to-point links, high-speed interprocessor channels and
  39. self-contained retransmission systems.  All of  these  links
  40. include  inherent  delays which vary with transmission rate,
  41. message  length  and   coding,   as   well   as   occasional
  42. retransmissions.  In addition, the host operating system can
  43. introduce delays  due  to  interrupt  latency,  interprocess
  44. communication   and   process   scheduling.    These  delays
  45. typically include  a  fixed  component  due  to  propagation
  46. phenomena,   together   with  a  relatively  small  variable
  47. component   due   to   internal   queueing,    coding    and
  48. retransmission mechanisms.
  49.  
  50. The  DCNET  architectural  design  includes  the  notion  of
  51. virtual host, which is a process resident in a physical host
  52. and labelled with a unique internet address.  One or more of
  53. these virtual hosts can reside in a single physical host and
  54. can migrate about the network from time to time in arbitrary
  55. ways.   Each  virtual  host  can  support  multiple internet
  56. protocols, connections and, in addition,  a  virtual  clock.
  57. Each  physical  host  contains  a  physical  clock which can
  58. operate at an arbitrary rate  and,  in  addition,  a  32-bit
  59.  
  60. Time Synchronization in DCNET Hosts                 PAGE   2
  61.  
  62.  
  63.  
  64. logical  clock  which operates at 1000 Hz.  Not all physical
  65. hosts implement the full 32-bit precision; however, in  such
  66. cases  the  resolution  of the logical clock may be somewhat
  67. less.
  68.  
  69. Routing of datagrams from a physical host  to  each  of  the
  70. virtual  hosts in the network is determined by a set of Host
  71. Tables, one in each physical  host,  which  are  updated  by
  72. HELLO  messages  exhanged on the links connecting them.  The
  73. HELLO messages are exchanged frequently, but not  so  as  to
  74. materially  degrade  the throughput of the link for ordinary
  75. data  messages.   They  contain  information  necessary   to
  76. compute  the roundtrip delay and logical clock offset of the
  77. receiving  physical  host  relative  to  the  sending   one,
  78. together with a table of delay and offset estimates computed
  79. between the sending physical host and each  of  the  virtual
  80. hosts  in  the  network.  For the purpose of these estimates
  81. the delay and offset of each virtual host  relative  to  the
  82. physical host in which it resides is assumed zero.
  83.  
  84. The Host Table  is  updated  by  HELLO  messages  from  each
  85. neighboring  physical  host and in certain other cases.  The
  86. updating algorithm is similar to that used  in  the  ARPANET
  87. and other places in that the roundtrip delay calculated to a
  88. neighbor is added to each of the delay  estimates  given  in
  89. its  HELLO message and compared with the corresponding delay
  90. estimates in the Host Table.  If a delay  computed  in  this
  91. way  is  less  than the delay already in the Host Table, the
  92. routing  to  the  corresponding  virtual  host  is   changed
  93. accordingly.   The  detailed  operation  of  this algorithm,
  94. which includes provisions for host up-down  logic  and  loop
  95. suppression, is summarized elsewhere [1].
  96.  
  97. Virtual Clocks
  98.  
  99. The Host Table  update  procedure  represents  a  convenient
  100. mechanism  to  implement  a  common  time reference for each
  101. logical clock in the network.  For this purpose each virtual
  102. clock  residing  in  a  physical  host  is assumed to run in
  103. synchronism with zero offset relative to the  logical  clock
  104. of that host.  The offsets of the other virtual hosts in the
  105. network, relative to this logical clock, are computed  along
  106. with  the  delays  as HELLO messages arrive from neighboring
  107. physical hosts.  A physical host,  upon  receiving  a  HELLO
  108. message,  adds  one-half  the difference between its logical
  109. clock and its neighbor's  logical  clock  contained  in  the
  110. HELLO  message  to  each of the offset values in the message
  111. and stores the result in its own Host Table.  Note that both
  112. the  delay and offset values are stored only if the neighbor
  113. is in fact on the least-delay path to the virtual  host  and
  114. that  the  link  delay  is assumed equal in both directions.
  115. Also, note that should a virtual host move from one physical
  116. host  to  another, the delays and offsets in all Host Tables
  117.  
  118. Time Synchronization in DCNET Hosts                 PAGE   3
  119.  
  120.  
  121.  
  122. relative to that virtual host would likely change.
  123.  
  124. Any user process  in  a  physical  host  can  reference  its
  125. time-of-day  calculations to any virtual host in the network
  126. by simply adding the appropriate virtual clock offset to the
  127. current value of the logical clock.  Ordinarily, all network
  128. experiments use the same  virtual  host  for  this  purpose,
  129. although   not   necessarily  the  same  one  in  successive
  130. experiments.  In  the  current  implementation  one  of  the
  131. physical  hosts contains a special virtual host connected to
  132. an NBS radio clock.  The offset stored  in  the  Host  Table
  133. corresponding  to  this  virtual host reflects the offset of
  134. this clock relative to the logical clock.  Using  the  above
  135. mechanism,  the remaining physical hosts can reference their
  136. logical clocks to the receiver as well.  One of the physical
  137. hosts  is  shortly  to be moved not far from an atomic clock
  138. which is referenced to the Naval Observatory clock  using  a
  139. local  television  station.  We are now assembling interface
  140. hardware for access to this standard and  plan  to  use  the
  141. above mechanism to reference all clocks to it.
  142.  
  143. Implementation Considerations
  144.  
  145. The absolute accuracy of the available NBS radio  clocks  is
  146. claimed  to  be  of  the order of a millisecond.  Since this
  147. precision  compares  with  that  of  the  standard  internet
  148. timestamps  used for the most precise delay measurements, it
  149. would be natural to strive  for  a  corresponding  precision
  150. within  a  set of hosts using the mechanism described above.
  151. Ordinarily, this would require a crystal oscillator, counter
  152. and  interface at each host.  The oscillator stability found
  153. in commercial equipment of this type is of the  order  of  a
  154. few  parts  per  million  under  laboratory  conditions.  An
  155. uncorrected logical clock based on this equipment  could  be
  156. expected  to  maintain  time  to within a millisecond for at
  157. least eight minutes and to within three minutes in a year.
  158.  
  159. In  the  case  of  the  mechanism   described   above,   the
  160. corrections  take  the form of offsets contained in periodic
  161. HELLO messages.  A careful analysis  of  the  non-systematic
  162. errors inherent in these messages reveals contributions from
  163. a number of sources dominated by the following:
  164.  
  165. 1.  The interval between the instant the local clock is read
  166.     and  the  departure of the first bit of the timestamp on
  167.     the link.
  168.  
  169. 2.  The  effect  of  the  data  coding   conventions   (e.g.
  170.     character  stuffing  or  bit  stuffing) used to maintain
  171.     data transparency.
  172.  
  173. 3.  The effect of retransmissions, where used.
  174.  
  175. Time Synchronization in DCNET Hosts                 PAGE   4
  176.  
  177.  
  178.  
  179. 4.  The interval between the arrival of the first bit of the
  180.     timestamp  and the instant it is compared with the local
  181.     clock.
  182.  
  183. The effects of the first and last of these delays  has  been
  184. minimized  in the DCNET implementation by careful control of
  185. internal latencies and scheduling mechanisms and is  limited
  186. to the order of a millisecond.  The effects of character and
  187. bit stuffing can be estimated under the assumption that  all
  188. character  codes  are  equally  likely.   In  that case, the
  189. effects of character stuffing would contribute a  factor  of
  190. about  1/256 to the uncertainty in data rate and the effects
  191. of bit stuffing would contribute about 1/32.  Thus, for  the
  192. case  of  1200-bps  character-stuffing  links carrying HELLO
  193. messages of typically 800 bits, the uncertainty would be  of
  194. the  order of two milliseconds.  The effects of bit stuffing
  195. in  the  high-speed  links  are  negligible  in  comparison.
  196. Although  HELLO  messages are never retransmitted by a DCNET
  197. host, some of the DCNET links, in particular those based  on
  198. the   ACC   Error  Control  Units  (ECU),  contain  internal
  199. retransmission features.   Since  retransmissions  occur  so
  200. seldom in the present configuration, their effects have been
  201. ignored; however, a simple range-gate technique  similar  to
  202. that  used  in  radar  systems  could  be used to filter out
  203. retransmissions, should that become a problem.
  204.  
  205. From the above  considerations  the  uncertainty  in  delays
  206. measured  using HELLO messages can be conservatively assumed
  207. in the order of five milliseconds.  For ease of analysis  in
  208. the following, we will assume the uncertainty to be a random
  209. variable  with  a  zero-mean  Gaussian  distribution  and  a
  210. standard  deviation of five milliseconds.  Thus, in order to
  211. reduce the  uncertainty  to  the  order  of  a  millisecond,
  212. something  over  25  independent  samples would be required.
  213. The maximum interval between successive  HELLO  messages  is
  214. thirty  seconds,  so  that  the  required  precision  can in
  215. principle be achieved in about twelve minutes.
  216.  
  217. Precise determination of clock  offsets  requires  that  the
  218. drift  rates between the various logical clocks be estimable
  219. with sufficient precision.  The approach chosen in the DCNET
  220. design  has  been  to initialize a variable representing the
  221. current offset of the local logical clock relative  to  that
  222. of  a  neighbor  each time a HELLO message arrives from that
  223. neighbor which updates the Host Table entry for the selected
  224. virtual  host.   Once  each second the period of the logical
  225. clock is increased by a quantity equal  to  1/1024  of  this
  226. variable and the variable is decreased by the same quantity.
  227. The effect is that of  a  first-order  recursive  filter  in
  228. smoothing  the  corrections  and  distributing them so as to
  229. minimize the phase jitter as viewed by the user process.  In
  230. addition, if updates from the selected virtual host are lost
  231. due to failure of some host or link, the logical clock  will
  232.  
  233. Time Synchronization in DCNET Hosts                 PAGE   5
  234.  
  235.  
  236.  
  237. continue  the  correction  process  until  the  last  offset
  238. received is compensated.
  239.  
  240. In order to provide for the initial setting of  the  logical
  241. clock  and  subsequent  drift  correction without disruptive
  242. phase discontinuties, the full 32-bit clock value is  stored
  243. only  if  the (signed) offset exceeds 16 bits; that is, only
  244. if the high-order 16 bits must be changed.  In  other  cases
  245. the  low-order 16 bits are corrected by slewing the phase of
  246. the clock according  to  the  current  offset  as  described
  247. above.    The  high-order  16  bits  correspond  roughly  to
  248. minutes,  while  the  low-order  16   bits   correspond   to
  249. milliseconds.   Most  internet measurments will be concerned
  250. primarily with the latter, so this behavior is  appropriate.
  251. This  yields a slew rate of about one microsecond per second
  252. for each millisecond of offset.
  253.  
  254. The dynamics of this procedure insure a smooth transition in
  255. apparent  drift rate from a maximum of 30 parts per thousand
  256. for the maximum offset to  one  part  per  million  for  the
  257. smallest.   The maximum time required to slew the phase of a
  258. physical clock  over  the  full  (plus-minus)  thirty-second
  259. range  to  steady  state  is  about  two  hours.  During the
  260. slewing interval the offset estimates continue to be  valid,
  261. although of somewhat degraded accuracy.
  262.  
  263. In  a  multiple-host   network   where   the   logical-clock
  264. corrections  must  pass  through a number of physical hosts,
  265. the robustness of this method depends on the cooperation  of
  266. all  intervening hosts.  In general, this requires all hosts
  267. to track the same virtual  host  offset  and,  in  addition,
  268. introduces   additional  dynamics  in  the  drift-correction
  269. process.  The effect is that of a set of coupled first-order
  270. recursive   filters,  where  the  input  of  each  stage  is
  271. connected to the output of the previous stage, and all  have
  272. the same time constant described previously.  So long as the
  273. drift rates are constant over at least several  hours,  this
  274. is  not  a  problem; however, in the case where some logical
  275. clocks are derived from power-line sources, this can lead to
  276. significant loss in accuracy.
  277.  
  278. On Power Line Clocks
  279.  
  280. The short-term drift rates of power-line clocks relative  to
  281. standard time have been observed to exceed several parts per
  282. thousand, with sharp changes in sign and magnitude  occuring
  283. near  periods  of  large  load fluctuations.  In experiments
  284. with the  current  DCNET  implementation,  discrepancies  of
  285. several   seconds   are   routinely   observed  between  the
  286. power-line clock and the NBS radio clock.   However,  it  is
  287. evident  that the power systems for considerable portions of
  288. this country are closely synchronized in phase  relative  to
  289. each  other.   For  instance,  the  DCNET  hosts  at  COMSAT
  290.  
  291. Time Synchronization in DCNET Hosts                 PAGE   6
  292.  
  293.  
  294.  
  295. Headquarters in Washington, D.C.,  and  at  Ford  Scientific
  296. Research Laboratories in Dearborn, Michigan, have never been
  297. observed to slip a power-line cycle relative to each other.
  298.  
  299. These observations suggest that, if logical clocks are to be
  300. synchronized  to  an  atomic  clock or NBS radio clock, then
  301. physical clocks based on the power mains are  not  feasible,
  302. at  least  for  accuracies of the order of milliseconds.  On
  303. the  other  hand,  for  the  short-term  delay  measurements
  304. required  for  many internet experiments and where reference
  305. to absolute time is not essential,  the  use  of  the  power
  306. mains as a synchronization reference may be quite practical.
  307. This holds, of course, only in those cases where  the  power
  308. systems in the areas where measurements are made are in fact
  309. synchronous and probably would not apply, for  example,  for
  310. European sites.
  311.  
  312. On Radio Clocks
  313.  
  314. Two of the NBS  radio  clocks  on  the  market  include  the
  315. Spectracom  8170  WWVB  Synchronized Clock and the True Time
  316. 468-DC Satellite Synchronized Clock.  The  former  uses  the
  317. 60-KHz  NBS  broadcast  from  Boulder,  Colorado,  while the
  318. latter uses the NOAA GOES  satellites.   Both  have  claimed
  319. accuracy  in  the  order of a millisecond and both support a
  320. service area including the  continental  US.   A  Spectracom
  321. 8170  is  now in service connected to one of the DCNET hosts
  322. and serves as a master clock for the network.  A  few  notes
  323. on  its  characteristics  may  be of interest, especially to
  324. others in the internet community planning on  using  similar
  325. equipment.
  326.  
  327. The characteristics of electromagnetic wave  propagation  at
  328. 60   KHz  combine  some  features  of  the  waveguide  model
  329. applicable at frequencies below about 30  KHz  and  the  ray
  330. model  applicable  at  higher  frequencies [2].  Both models
  331. explain how the E layer, an  ionized  region  about  100  km
  332. above    the    earth's    surface,   guides   or   reflects
  333. electromagnetic waves over long distances.  In the  case  of
  334. 60-KHz   transmissions  from  Boulder,  the  models  predict
  335. greater signal attenuation at  times  of  the  most  intense
  336. ionizing  radiation from the sun on the D region, which lies
  337. just below the E region and through which the  signals  must
  338. pass.   Thus,  one  would expect that received signal levels
  339. would be highest  at  nighttime  in  winter  and  lowest  in
  340. daytime  in summer, with respect to the midpoint of the path
  341. from Boulder to the receiver.  This  has  been  observed  in
  342. Washington,  DC, where the receiver often drops out of phase
  343. lock  for   varying   periods   in   the   late   afternoon.
  344. Measurements   of   the   received   signal   level  with  a
  345. communications  reveiver   confirm   variations   of   20-30
  346. decibels.
  347.  
  348. Time Synchronization in DCNET Hosts                 PAGE   7
  349.  
  350.  
  351.  
  352. Atmospheric discharges (called sferics) due to lightning can
  353. be a severe problem at these frequencies in Summer and could
  354. be expected to disrupt the receiver during  summer  evenings
  355. when  propagation conditions are relatively good from active
  356. electrical  areas  like  the  Gulf  Coast.   Although  other
  357. stations  share the 60-KHz assigned frequency, including MSF
  358. in Rugby, UK, co-channel interference does not seem to be  a
  359. problem.   On  the  other  hand,  some  household electrical
  360. appliances, including  television  deflection  circuits  and
  361. solid-state  lamp  dimmers,  can  generate copious harmonics
  362. that disrupt the receiver.   The  ferrite  antenna  supplied
  363. with  the receiver does not seem to be as effective as would
  364. ordinarily be expected in dealing with this problem.
  365.  
  366. Even when phase lock has  been  lost,  the  receiver  coasts
  367. indefinately using the last clock update received.  Although
  368. the receiver indicates a signal loss of  over  ten  minutes,
  369. both by a front-panel indicator and in the time message sent
  370. to the attached  host,  the  indicated  time  should  remain
  371. accurate  to  within  an  order of one part in a million, as
  372. suggested by tests using an accurate frequency counter.  The
  373. DCNET implementation polls the receiver every thirty seconds
  374. and tracks the time messages as long as they are  available,
  375. but  retains the last received message for later inspection,
  376. if desired.  In addition, if the time messages are lost  the
  377. system  continues  to  follow  the  information  in the last
  378. message.
  379.  
  380. Summary and Conclusions
  381.  
  382. The  above  analysis  indicates  that  logical   clocks   in
  383. neighboring   physical   hosts  can  be  synchronized  using
  384. ordinary local-network routing update messages, so  long  as
  385. the  oscillator  drift  rates  are  stable and do not differ
  386. radically.   A  multiple-host   network   can   readily   be
  387. synchronized  so long as each pair of neighboring hosts can,
  388. although this can require rather long settling times.  Here,
  389. two  hosts are assumed synchronized when the offsets between
  390. their respective logical  clocks  can  be  calculated  to  a
  391. precision of the order of a millisecond.
  392.  
  393. Delay and offset variances along internet paths  are  likely
  394. to  be  so  large  as  to make the technique described above
  395. impractical, at least  if  millisecond  accuracy  is  to  be
  396. preserved.   The  present plan of installing radio clocks in
  397. the internet  gateways  appears  to  be  the  most  sensible
  398. alternative.   The  gateways  thus  form  an attractive time
  399. reference for the hosts on the attached local networks.  The
  400. gateways  themselves could include the offsets between their
  401. own clocks in Gateway-Gateway Protocol (GGP) routing  update
  402. messages,  if  not  all of them were equipped with NBS radio
  403. clocks, and could conveniently provide this  information  in
  404. GGP  echo messages to the local network hosts.  In order for
  405.  
  406. Time Synchronization in DCNET Hosts                 PAGE   8
  407.  
  408.  
  409.  
  410. this to be most effective, the timestamping  mechanism  used
  411. by the gateways (and hosts, of course) should be implemented
  412. as close  to  the  network  interface  driver  as  possible,
  413. preferably by the driver itself.
  414.  
  415. A local-network host can synchronize its logical clock to  a
  416. gateway by a mechanism suggested by the DCNET routing update
  417. procedure.  The host sends a  GGP  echo  packet  timestamped
  418. with its logical clock to a gateway.  The gateway timestamps
  419. it with its own logical clock upon arrival and again when it
  420. is  retransmitted  to  the  host.  The local host uses these
  421. three timestamps, together with the time of arrival  of  the
  422. reply  packet,  to compute the delay and offset as described
  423. above.  The use of three timestamps in the GGP  echo  packet
  424. allows  the host to compensate for the internal delay within
  425. the gateway, if significant.
  426.  
  427. References
  428.  
  429. 1.  COMSAT Laboratories Quarterly  Progress  Reports.   Stay
  430.     tuned.
  431.  
  432. 2.  Davies,  K.    Ionospheric   Radio   Propagation.    NBS
  433.     Monograph  80, National Bureau of Standards, Washington,
  434.     DC, 1966.
  435.  
  436.  
  437.